]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
dbusServices/screencast: Handle pipeline failures gracefully
authorFlorian Müllner <fmuellner@gnome.org>
Wed, 9 Jun 2021 14:42:52 +0000 (16:42 +0200)
committerMarge Bot <marge-bot@gnome.org>
Wed, 9 Jun 2021 15:21:35 +0000 (15:21 +0000)
If parsing the pipeline fails for some reason, we currently end up
with a zombie session that leads to a stuck recording indicator in
gnome-shell.

Instead, properly tear down the session to allow mutter and gnome-shell
to correctly update their state.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1878>

js/dbusServices/screencast/screencastService.js

index fb56fdb3a76f26300b345626897f00ce1505b2d7..708a15c84e6be2134d824e5a4e6fd90df35fa63d 100644 (file)
@@ -136,7 +136,8 @@ var Recorder = class {
     }
 
     _startPipeline(nodeId) {
-        this._ensurePipeline(nodeId);
+        if (!this._ensurePipeline(nodeId))
+            return;
 
         const bus = this._pipeline.get_bus();
         bus.add_watch(bus, this._onBusMessage.bind(this));
@@ -234,9 +235,15 @@ var Recorder = class {
             filesink location="${this._filePath}"`;
         fullPipeline = this._substituteThreadCount(fullPipeline);
 
-        this._pipeline = Gst.parse_launch_full(fullPipeline,
-            null,
-            Gst.ParseFlags.FATAL_ERRORS);
+        try {
+            this._pipeline = Gst.parse_launch_full(fullPipeline,
+                null,
+                Gst.ParseFlags.FATAL_ERRORS);
+        }  catch (e) {
+            log(`Failed to create pipeline: ${e}`);
+            this._notifyStopped();
+        }
+        return !!this._pipeline;
     }
 };